package com.yjhb.android.sbz.enums;


/**
 * 用于表示发布任务的一系列状态
 */
public enum TaskState {

    TASK_STATE_UNKNOWN(-99,"未知状态"),
    TASK_STATE_WAIT(0, "待上架"),
    TASK_STATE_DISPLAY(1, "展示中"),
    TASK_STATE_FAIL(2, "审核失败"),
    TASK_STATE_STOP(3, "已暂停"),
    TASK_STATE_LACK(4, "库存不足"),
    TASK_STATE_OFF(5, "已下架"),
    TASK_STATE_VIOLATION(6, "违规下架");

    TaskState(int state, String stateStr) {
        this.stateStr = stateStr;
        this.state = state;
    }

    private int state;
    private String stateStr;


    public int getState() {
        return state;
    }

    public String getStateStr() {
        return stateStr;
    }


    public static TaskState getState(int state) {
        switch (state) {
            case 0:
                return TASK_STATE_WAIT;
            case 1:
                return TASK_STATE_DISPLAY;
            case 2:
                return TASK_STATE_FAIL;
            case 3:
                return TASK_STATE_STOP;
            case 4:
                return TASK_STATE_LACK;
            case 5:
                return TASK_STATE_OFF;
            case 6:
                return TASK_STATE_VIOLATION;
            default:
                return TASK_STATE_UNKNOWN;
        }
    }

}
